package frame.options.simulation.results.virtualNetworks.graphical;

import model.components.links.link.Link;
import model.components.nodes.node.Node;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.visualization.VisualizationViewer;
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse;
import edu.uci.ics.jung.visualization.decorators.EdgeShape;
import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position;
import frame.options.simulation.results.ResultsFrame;

@SuppressWarnings("serial")
public class VirtualNetworkVisualizationViewer extends VisualizationViewer< Node, Link >
{
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public VirtualNetworkVisualizationViewer( Layout< Node, Link > layout, ResultsFrame frameResults )
	{
		super( layout );
		
		this.getRenderContext().setVertexIconTransformer( new VirtualNodeIconTransformer() );
		this.getRenderContext().setVertexLabelTransformer( new VirtualNodeLabelTransformer() );
		this.getRenderer().getVertexLabelRenderer().setPosition( Position.AUTO );
			
		this.getRenderContext().setEdgeShapeTransformer( new EdgeShape.CubicCurve() );
		this.getRenderContext().setEdgeDrawPaintTransformer( new VirtualLinkColorTransformer() );
			
		DefaultModalGraphMouse< Node, Link > defaultModalGraphMouse = new DefaultModalGraphMouse< Node, Link >();
		defaultModalGraphMouse.setMode( DefaultModalGraphMouse.Mode.TRANSFORMING );
		defaultModalGraphMouse.add( new VirtualNetworkPopupGraphMousePlugin( frameResults ) );
	        
		this.addKeyListener( defaultModalGraphMouse.getModeKeyListener() );
		this.setGraphMouse( defaultModalGraphMouse );
	}
	
}
